package com.sc.nft.config.fulu;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * 福禄配置信息
 *
 * @author liGen
 * @version 1.0
 * @date 2023/11/6 3:54 下午
 */
@Configuration
@Slf4j
public class FuLuInit {

    /**
     * 商户KEY
     */
    @Value("${flConfig.appKey}")
    private String appKey;

    /**
     * 商户密钥
     */
    @Value("${flConfig.appSecret}")
    private String appSecret;

    /**
     * 请求地址
     */
    @Value("${flConfig.apiHttpUrl}")
    private String apiHttpUrl;

    /**
     * 请求地址(https)
     */
    @Value("${flConfig.apiHttpsUrl}")
    private String apiHttpsUrl;

    /**
     * 商品列表接口方法
     */
    @Value("${flConfig.goodsListMethod}")
    private String goodsListMethod;

    /**
     * 商品信息接口方法
     */
    @Value("${flConfig.goodsInfoMethod}")
    private String goodsInfoMethod;

    /**
     * 商品模板接口方法
     */
    @Value("${flConfig.goodsTemplateMethod}")
    private String goodsTemplateMethod;

    /**
     * 直充下单接口方法
     */
    @Value("${flConfig.orderDirectMethod}")
    private String orderDirectMethod;

    /**
     * 订单查询接口方法
     */
    @Value("${flConfig.orderInfoMethod}")
    private String orderInfoMethod;

    /**
     * 编码格式
     */
    @Value("${flConfig.charset}")
    private String charset;

    /**
     * 签名加密类型
     */
    @Value("${flConfig.signType}")
    private String signType;

    /**
     * 接口请求或响应格式
     */
    @Value("${flConfig.format}")
    private String format;

    /**
     * 接口请求或响应格式
     */
    @Value("${flConfig.version}")
    private String version;

    @PostConstruct
    public void initFuLuConfig() throws Exception {
        FuLuConfig.appKey = appKey;
        FuLuConfig.appSecret = appSecret;
        FuLuConfig.apiHttpUrl = apiHttpUrl;
        FuLuConfig.apiHttpsUrl = apiHttpsUrl;
        FuLuConfig.goodsListMethod = goodsListMethod;
        FuLuConfig.goodsInfoMethod = goodsInfoMethod;
        FuLuConfig.goodsTemplateMethod = goodsTemplateMethod;
        FuLuConfig.orderDirectMethod = orderDirectMethod;
        FuLuConfig.orderInfoMethod = orderInfoMethod;
        FuLuConfig.charset = charset;
        FuLuConfig.signType = signType;
        FuLuConfig.format = format;
        FuLuConfig.version = version;
        FuLuConfig.appAuthToken = "";
    }
}
